/** Implementation of Token Class.
 * @file 
 * @author Jeremy Schultz
 */
#include "Token.h"

using namespace std;

//-----------------------------------------------------------------------------
// Constructor
Token::Token()  {
	type = Token::EMPTY;
}

//-----------------------------------------------------------------------------
// Constructor
Token::Token(TokenType _type)  {
	type = _type;
}

//-----------------------------------------------------------------------------
// 
string Token::toString(Token::TokenType t) {
	#define CASE(x)	case Token::x: return #x
	switch(t) {
		CASE(ERROR);
		CASE(EMPTY);
		CASE(ID);
		CASE(KEYWORD);
		CASE(NUMBER);
		CASE(AND);
		CASE(LEFT_PARATHESIS);
		CASE(RIGHT_PARATHESIS);
		CASE(TIMES);
		CASE(ADD);
		CASE(COMMA);
		CASE(ARROW);
		CASE(MINUS);
		CASE(PERIOD);
		CASE(DIV);
		CASE(ASSIGN);
		CASE(SEMI_COLON);
		CASE(LESS_THAN);
		CASE(EQUAL);
		CASE(GREATER_THAN);
		CASE(GUARD_SEPERATOR);
		CASE(LEFT_BRACKET);
		CASE(MOD);
		CASE(RIGHT_BRACKET);
		CASE(OR);
		CASE(NOT);

		default:
			return "Unkown";
	}
	#undef CASE
}

//-----------------------------------------------------------------------------
// Get the Token Type
Token::TokenType Token::Type()	{
	return  type;
}

//-----------------------------------------------------------------------------
// toString
string Token::toString()	{
	stringstream ss;

	ss << "type: " << type;

	return ss.str();
}


